package com.zsh.fmmall.controller;

import com.zsh.fmmall.service.ProductService;
import com.zsh.fmmall.vo.ResultVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/product")
@Api(value = "提供商品详情信息相关接口",tags = "商品管理")
@CrossOrigin//利用后端注解的方式解决跨域请求
public class ProductController {
    @Autowired
    private ProductService productService;

    @ApiOperation("通过商品id获取商品详情信息的接⼝")
    @ApiImplicitParam(dataType = "string",name = "productId", value = "商品id",required =true)
    @GetMapping("/detail-info/{productId}")
    public ResultVO getProductBasicInfo(@PathVariable("productId") String pid){
        return productService.getProductBasicInfo(pid);
    }
}
